"""
Description:
Author: 月间
Date: 2025-05-19 23:53:48
LastEditTime: 2025-10-01 02:24:31
LastEditors:
"""

import logging

import uvicorn
from src.app import create_app
from src.config import settings
from src.log.logger import init_logger

init_logger(
    intercept_std_logging=True,
    level=logging.INFO,
)

app = create_app()
if __name__ == "__main__":
    config = uvicorn.Config(
        app=app,
        host=settings.FASTAPI_CONFIG.HOST.__str__(),
        port=settings.FASTAPI_CONFIG.PORT,
        lifespan="on",
        # log_config=None,  # 关闭日志, 使用loguru
        access_log=False,
        reload=settings.system.DEBUG,
    )
    server = uvicorn.Server(config=config)
    # 设置日志
    server.run()
